var userTree = null;
$(function(){
	var setts = {
		    view:{
		    	dblClickExpand: false
		    },
			check: {
			    enable: true,
			    chkboxType :{ "Y" : "s", "N" : "s" }

			},
			async : {
				enable : true,
				url : "business/component!ztree",
				autoParam : ["id=bean.id"],
				otherParam:{"mapDefaultActionMethod":false}
			   // dataFilter: filter
			}
		};

		var roots = [
		              {
		            	  name : "北方特种能源有限公司西安庆华公司",
		          		  open : true,
		          		  nocheck:true,
		          		  id:"root",
		          		  isParent:true
		              }              
		];
		
		userTree = $.fn.zTree.init($("#userTree") , setts ,roots);
	var root = userTree.getNodes();
	userTree.expandNode(root[0]);
	$("button.resend").bind("click",function(){
		doResend();
	});

	
});
function doResend(){
		var nodes = userTree.getCheckedNodes(true);
		if(nodes.length==0){
			alert("请选择至少一个用户！");
			return;
		}
		var datastr = "bean.id="+fileId;
		for(var i=0;i<nodes.length;i++){
			var n = nodes[i];
			datastr+="&bean.readers["+i+"].username="+n.id+"&";		
		}	
		doPost("fileflow/file/fileflow!send",datastr);
    }
